using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using digit.Core;
using SMS.UserManager;
using SMS.ServiceManager;

namespace SMS.Admin.Modules
{
    public partial class DetailMessageOut : WebControlBase
    {
        private long msgId;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!ClientState.IsAuthenticated)
            {
                Response.Redirect("~/Login.aspx?session=timeout");
            }

            msgId = Request.QueryString["msgId"] != null ? long.Parse(Request.QueryString["msgId"].ToString().Trim()) : 0;

            if (IsPostBack) return;

            BindInfo();
        }

        private void BindInfo()
        {
            MessageOutInfo objMsg = MessageOutManager.Select(msgId);

            if (objMsg != null)
            {
                this.lblCommandCode.Text = objMsg.CommandCode;
                this.lblIsCDR.Text = objMsg.IsCDR.ToString();
                this.lblMobileNo.Text = objMsg.MobileNo;
                this.lblMsgInContent.Text = objMsg.MsgInContent;
                this.lblMsgIndex.Text = objMsg.MsgIndex.ToString();
                this.lblMsgInID.Text = objMsg.MsgInID.ToString();
                this.lblMsgOutID.Text = objMsg.MsgOutID.ToString();
                this.lblMsgType.Text = objMsg.MsgType.ToString();
                this.ddlType.SelectedValue = objMsg.ContentType.ToString();
                this.lblRequestTime.Text = objMsg.RequestTime.ToString("dd/MM/yyyy hh:mm:ss");
                this.lblResponseTime.Text = objMsg.ResponseTime.ToString("dd/MM/yyyy hh:mm:ss");
                this.lblServiceID.Text = objMsg.ServiceID;
                this.lblReceiverMobileNo.Text = objMsg.ReceiverMobileNo;
                this.lblMsgTotal.Text = objMsg.MsgTotal.ToString();
                this.lblMsgOutContent.Text = objMsg.MsgOutContent;
            }
        }

        protected void lnkBack_Click(object sender, System.EventArgs e)
        {
            Response.Redirect("Default.aspx?module=ListMessageOut");
        }
    }
}
